package chalmers.game.subterranean.model.world.squares.blocks.actionblocks;

import chalmers.game.subterranean.util.BlockType;
import chalmers.game.subterranean.util.Position;
import chalmers.game.subterranean.util.Resource;
import lombok.Getter;
import lombok.Setter;
import org.apache.log4j.Logger;

/**
 * User: Mikael Friederici Date: 2014-05-16 Time: 01:18
 */
public class Teleport extends ActionBlock {

  private static final Logger logger = Logger.getLogger("subLog");

  private static final BlockType type = new BlockType(BlockType.Action.TELEPORT);
  private @Setter
  @Getter
  Position otherEnd;

  public Teleport(Position otherEnd) {
    this.otherEnd = otherEnd;
  }

  @Override
  public boolean handlePressAgainst() {
    return true;
  }

  @Override
  public Resource getResource() {
    return Resource.NOTHING;
  }

  @Override
  public void handleAction() {
    if (otherEnd != null) {
      // TODO move player to position otherEnd.
      logger.info("Player should move to " + otherEnd.toString());
    } else {
      logger.info("Error: teleport has no exit!");
    }
  }

  @Override
  public BlockType handleGetType() {
    return type;
  }

}
